﻿using System.Threading.Tasks;
using TaskTodo.Localization;
using Volo.Abp.UI.Navigation;

namespace TaskTodo.Web.Menus
{
    public class TaskTodoMenuContributor : IMenuContributor
    {
        public async Task ConfigureMenuAsync(MenuConfigurationContext context)
        {
            if (context.Menu.Name == StandardMenus.Main)
            {
                await ConfigureMainMenuAsync(context);
            }
        }

        private Task ConfigureMainMenuAsync(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer<TaskTodoResource>();
            //Add main menu items.
            context.Menu.AddItem(
                    new ApplicationMenuItem(TaskTodoMenus.Prefix, displayName:l["Menu:TaskTodo"], "~/TaskTodo", icon: "fa fa-globe")
                        .AddItem(new ApplicationMenuItem(TaskTodoMenus.Home, displayName: l["Menu:TaskTodoHome"], "~/TaskTodo/Home", icon: "fa fa-globe"))
                );

            return Task.CompletedTask;
        }
    }
}